package cn.xuewei.utils;

import cn.xuewei.pojo.vo.UserChatVO;
import cn.xuewei.service.WebSocket;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 统一管理session、websocket、curUser
 */
public class CurPool {

//    public static CopyOnWriteArraySet<WebSocket> webSockets =new CopyOnWriteArraySet<>();
    //用来存储每一个客户端对象对应的websocket对象
    public static Map<Integer, WebSocket> webSockets = new ConcurrentHashMap<>();
    //并发编程,map的子实现类


//     list 里面第一个存sessionId，第二个存session
//     声明session对象.通过该对象可以发送消息给指定的用户
    public static Map<Integer, List<Object>> sessionPool = new ConcurrentHashMap<>();
    // 当前登录用户x
    public static Map<String, UserChatVO> curUserPool = new ConcurrentHashMap<>();
}
